#ifndef DEFECTINFO_H
#define DEFECTINFO_H

#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonParseError>
#include <QObject>
#include <QRectF>

/**
 * @brief The DefectInfo 类表示一个缺陷内容,for JSON
 */
class DefectInfo : public QObject
{
    Q_OBJECT
public:
    DefectInfo();
    DefectInfo(const DefectInfo &other);

    ~DefectInfo();

public:
    QString type;
    QRectF range;

public:
    void SetType(QString type);
    void SetRange(QRectF rect);

    QString GetType();
    QRectF GetRange();

    DefectInfo &operator=(const DefectInfo &other);

public:
    QString toJson();

    bool FromJson(QJsonValue jsonValue);
    bool FromJson(QJsonObject defectInfoObject);

    void test();
};

#endif // DEFECTINFO_H
